<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>testUploadify</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="<%=basePath%>/js/jquery-3.2.0.min.js"></script>
<link href="<%=basePath%>/js/uploadify-v3.1/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<%=basePath%>/js/uploadify-v3.1/jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/uploadify-v3.1/swfobject.js"></script>
<script type="text/javascript">
$(function(){
    $('#testUploadify').uploadify({
        'swf' : '<%=basePath%>/js/uploadify-v3.1/uploadify.swf',
        'uploader' : '<%=basePath%>/uploadify',
        //'queueID' : 'fileQueue', //和存放队列的DIV的id一致
        //'fileDataName': 'fileupload', //必须，和以下input的name属性一致
        'auto' : true, //是否自动开始
        'multi' : true, //是否支持多文件上传
        'buttonText' : '上传材料', //按钮上的文字
        'simUploadLimit' : 1, //一次同步上传的文件数目
        //'sizeLimit' : 20 * 1024 * 1024, //设置单个文件大小限制，单位为byte
        'fileSizeLimit' : '1000MB',
        'width' : 120,
        'queueSizeLimit' : 10, //队列中同时存在的文件个数限制
        'fileTypeExts' : '*.txt;*.doc;*.docx;*.xls;*.xlsx;*.rar;*.zip;*.png;*.jpg;*.gif;*.pdf;*.wps;*.tif', //允许的格式
        'fileTypeDesc' : '支持格式:', //如果配置了以下的'fileExt'属性，那么这个属性是必须的
        'onUploadSuccess' : function(fileObj, data, response) {
            alert("文件:" + fileObj.name + "上传成功" + data);
        },
        'onUploadError' : function(event, queueID, fileObj) {
            alert("文件:" + fileObj.name + "上传失败");
        },
        'onCancel' : function(event, queueID, fileObj) {
            //alert("取消了" + fileObj.name);
        },
        'onInit' : function (){
            //$(".uploadify-queue").hide();
        }
    });
});
</script>
</head>

<body>
	<input type="file" name="file" id="testUploadify" />
</body>
</html>
